<!DOCTYPE html>
<html lang="zh-CN">
<head>
  <meta charset="UTF-8">
  <meta name="viewport" content="width=device-width, initial-scale=1.0">
  <title>Node.js 后端示例</title>
  <style>
    body {
      font-family: 'Arial', sans-serif;
      max-width: 800px;
      margin: 0 auto;
      padding: 20px;
      color: #333;
    }
    h1 {
      color: #2c3e50;
    }
    .api-section {
      background: #f8f9fa;
      padding: 20px;
      margin: 20px 0;
      border-radius: 8px;
    }
    code {
      background: #e9ecef;
      padding: 2px 5px;
      border-radius: 3px;
    }
    .endpoint {
      font-weight: bold;
      color: #007bff;
    }
  </style>
</head>
<body>
  <h1>Node.js 后端示例项目</h1>
  
  <p>这是一个使用中文封装Express API的Node.js后端示例项目。</p>
  
  <div class="api-section">
    <h2>API接口列表</h2>
    
    <h3>基础接口</h3>
    <ul>
      <li><span class="endpoint">GET /</span> - API根路径，返回欢迎信息</li>
      <li><span class="endpoint">GET /api/hello</span> - Hello World示例</li>
    </ul>
    
    <h3>用户相关</h3>
    <ul>
      <li><span class="endpoint">GET /api/user/:id</span> - 根据ID获取用户信息</li>
      <li><span class="endpoint">POST /api/login</span> - 用户登录</li>
      <li><span class="endpoint">GET /api/session</span> - 获取会话信息</li>
      <li><span class="endpoint">POST /api/logout</span> - 用户登出</li>
    </ul>
  </div>
  
  <div class="api-section">
    <h2>如何测试</h2>
    <p>您可以使用Postman或curl等工具测试API：</p>
    <pre><code># 测试Hello World接口
curl http://localhost:3000/api/hello

# 测试用户登录
curl -X POST -H "Content-Type: application/json" -d '{"username":"test","password":"123456"}' http://localhost:3000/api/login</code></pre>
  </div>
</body>
</html>